/* 该文件专门用于创建reducer，用于加工、初始化状态 */

export default function reducer (preState,action){
	console.log(preState,action)
	const {type,data} = action
	if(preState === undefined){
		//若是初始化
		return 0
	}else{
		//若是加工
		if(type === 'jia'){
			console.log('确实是jia')
			return preState + data
		}
		else if(type === 'jian'){
			return preState - data
		}
	}
}